package com.yswy.common.wxOrder.V3;

import com.yswy.common.utils.StringUtils;
import lombok.Data;

import java.util.*;

@Data
public class GenerateSignVo {
    private String appId ; // 替换为你的微信应用ID
    private String partnerId ; // 替换为你的商户ID
    private String prepayId ; // 替换为你的预支付交易会话ID
    private String nonceStr = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32); // 替换为随机生成的字符串
    private String timeStamp = new Date().getTime()+""; // 替换为时间戳
    private String packageValue = "Sign=WXPay" ; // 替换为扩展字段，通常为 "Sign=WXPay"
    private String sing ;//v3密钥
    public static String getSignStr(Map<String, Object> params) {
        List<String> paramStr = new ArrayList<>(params.size());
        for (String key : params.keySet()) {
            paramStr.add(key + "=" + params.get(key));
        }
        Collections.sort(paramStr);
        return StringUtils.join(paramStr, "&");
    }
}
